﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using iSun.SYS.Library;
using iSun.Model;
using iSun.Common;
namespace iSun.SYS.Bussiness.Message
{

    public partial class BV_MessagePool : BLL.Base.BaseBussnies<V_MessagePool>
    {
        public BV_MessagePool() { this.entity = new V_MessagePool(); }


          /// <summary>
          /// 获取指定用户的全部信息
          /// </summary>
          /// <param name="ReceiverID">接收者</param>
          /// <returns></returns>
        public IList<V_MessagePool> GetUnreadSysMessages(Guid? ReceiverID)
        {
            try
            {

                string s ="ReceiverID='" + ReceiverID.ToString() + "'";
                return this.GetEntityListByCondition<V_MessagePool>(s);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 获取未读信息 即时提醒用 
        /// </summary>
        /// <param name="ReceiverID">接收者</param>
        /// <returns></returns>
        public V_MessagePool GetNewestUnreadMessage(Guid? ReceiverID)
        {
            try
            {

                string s = "select top 1 * from V_MessagePool where ReceiverID='" + ReceiverID.ToString() + "'";
                return (V_MessagePool)this.GetEntityBySqlComm(s);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
